﻿Imports System.Net
Imports System.IO

Public Class Nabaztag
    Private WithEvents _client As New WebClient
    Private _reader As StreamReader
    Private _urlTemplate As String = "http://api.nabaztag.com/vl/FR/api.jsp?sn=0019db9e9249&token=1212901740&nabcasttitle={0}&tts={1}&voice={2}"

    Public Enum VoicesEnum As Integer
        AU_Colleen
        AU_Jon
        UK_Edwin
        UK_Leonard
        UK_Mistermuggles
        UK_Penelope
        UK_Shirley
        US_Bethany
        US_Billye
        US_Clarence
        US_Darleen
        US_Liberty
        US_Lilian
    End Enum

    Public Sub SendMessage(ByVal Title As String, ByVal Message As String, ByVal Voice As VoicesEnum)
        Dim url As String = String.Format(_urlTemplate, Title, Message, Voice.ToString.Replace("_"c, "-"c))
        Dim aUri As New Uri(url)
        _client.DownloadDataAsync(aUri)
    End Sub

    Private Sub _client_DownloadDataCompleted(ByVal sender As Object, ByVal e As System.Net.DownloadDataCompletedEventArgs) Handles _client.DownloadDataCompleted

    End Sub
End Class
